<?php
//用于将word文档转换为html，需调用WINWORD.EXE，所以需要windows环境
word2html("http://127.0.0.165/Public/Upload/Homework/test2/577a5a2b47acb.docx",dirname(__FILE__)."/1.html"); 
//word2html("F:/PHP Project/www/OSC@SVN/1.doc","F:/PHP Project/www/OSC@SVN/1.html"); //需要路径可以用cmd访问，故不能加空格
function word2html($wordname,$htmlname) 
 { 
 $word = new COM("word.application") or die("Unable to instanciate Word"); 
 print("Loaded Word, version {$word->Version}<BR>");	
 $word->Visible = 1; 
 $word->Documents->Open($wordname);
//$word->Documents->Add();
//$word->Selection->TypeText("This is a test...");
//$word->Documents[1]->SaveAs(dirname(__FILE__)."/create_test.doc");
 $word->Documents[1]->SaveAs($htmlname,8); 
 $word->Quit(); 
 $word = null; 
 unset($word); 
 } 